/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Jayasundara
 */
@Entity
@Table(name = "task", catalog = "postgres", schema = "public")
@NamedQueries({@NamedQuery(name = "Task.findAll", query = "SELECT t FROM Task t"), @NamedQuery(name = "Task.findById", query = "SELECT t FROM Task t WHERE t.id = :id"), @NamedQuery(name = "Task.findBySummary", query = "SELECT t FROM Task t WHERE t.summary = :summary"), @NamedQuery(name = "Task.findByDueDate", query = "SELECT t FROM Task t WHERE t.dueDate = :dueDate"), @NamedQuery(name = "Task.findByDescription", query = "SELECT t FROM Task t WHERE t.description = :description")})
public class Task implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "summary", length = 25)
    private String summary;
    @Column(name = "due_date")
    @Temporal(TemporalType.DATE)
    private Date dueDate;
    @Column(name = "description", length = 250)
    private String description;
    @OneToMany(mappedBy = "taskId")
    private List<FixVersion> fixVersionCollection;
    @JoinColumn(name = "component_id", referencedColumnName = "id")
    @ManyToOne
    private Component componentId;
    @JoinColumn(name = "priority_id", referencedColumnName = "id")
    @ManyToOne
    private Priority priorityId;
    @JoinColumn(name = "task_type_id", referencedColumnName = "id")
    @ManyToOne
    private TaskType taskTypeId;
    @JoinColumn(name = "assignee_id", referencedColumnName = "id")
    @ManyToOne
    private User assigneeId;
    @JoinColumn(name = "recorder_id", referencedColumnName = "id")
    @ManyToOne
    private User recorderId;
    @JoinColumn(name = "reporter_id", referencedColumnName = "id")
    @ManyToOne
    private User reporterId;
    @OneToMany(mappedBy = "taskId")
    private List<AffectedVersions> affectedVersionsCollection;

    public Task() {
    }

    public Task(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Date getDueDate() {
        return dueDate;
    }

    public void setDueDate(Date dueDate) {
        this.dueDate = dueDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<FixVersion> getFixVersionCollection() {
        return fixVersionCollection;
    }

    public void setFixVersionCollection(List<FixVersion> fixVersionCollection) {
        this.fixVersionCollection = fixVersionCollection;
    }

    public Component getComponentId() {
        return componentId;
    }

    public void setComponentId(Component componentId) {
        this.componentId = componentId;
    }

    public Priority getPriorityId() {
        return priorityId;
    }

    public void setPriorityId(Priority priorityId) {
        this.priorityId = priorityId;
    }

    public TaskType getTaskTypeId() {
        return taskTypeId;
    }

    public void setTaskTypeId(TaskType taskTypeId) {
        this.taskTypeId = taskTypeId;
    }

    public User getAssigneeId() {
        return assigneeId;
    }

    public void setAssigneeId(User assigneeId) {
        this.assigneeId = assigneeId;
    }

    public User getRecorderId() {
        return recorderId;
    }

    public void setRecorderId(User recorderId) {
        this.recorderId = recorderId;
    }

    public User getReporterId() {
        return reporterId;
    }

    public void setReporterId(User reporterId) {
        this.reporterId = reporterId;
    }

    public List<AffectedVersions> getAffectedVersionsCollection() {
        return affectedVersionsCollection;
    }

    public void setAffectedVersionsCollection(List<AffectedVersions> affectedVersionsCollection) {
        this.affectedVersionsCollection = affectedVersionsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Task)) {
            return false;
        }
        Task other = (Task) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.me.entity.Task[id=" + id + "]";
    }

}
